package com.xs.shiyan;

import java.util.Scanner;

public class shiyan1 {
    public static void main(String[] args) {
        //飞机机票的价格查询
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入机票原价");
        double money=sc.nextDouble();

        System.out.println("请输入月份");
        int moth=sc.nextInt();

        System.out.println("请选择仓位类型");
        String cx=sc.next();

        System.out.println("优惠后的机票价格为："+calc(money,moth,cx));

    }

    public static double calc(double money,int moth,String cx){

        if (moth>=5 && moth<=10){
            //旺季
            switch (cx){
                case "头等舱":
                    money *=0.9;
                    break;
                case "经济舱":
                    money*=0.85;
                    break;
                default:
                    System.out.println("你小子给我输入正确的舱位啊，你是不是想造反");
                    money=-1;
            }
        }
        else if (moth==11||moth==12||moth>=1&&moth<5){
            //淡季
            switch (cx){
                case "头等舱":
                    money *=0.7;
                    break;
                case "经济舱":
                    money*=0.65;
                    break;
                default:
                    System.out.println("你小子给我输入正确的舱位啊，你是不是想造反");
                    money=-1;
            }
            return money;
        }
        System.out.println("对不起  你输入的月份有问题");
        return -1;
    }

}
